<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
	String contextPath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">  
<meta http-equiv="cache-control" content="no-cache">  
<meta http-equiv="expires" content="0"> 

<link rel="stylesheet" type="text/css" href="<%=contextPath %>/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=contextPath %>/themes/icon.css">
<script type="text/javascript" src="<%=contextPath %>/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=contextPath %>/js/base.js"></script>
<script>contextPath = "<%=contextPath %>";</script>

<script language="javascript">
$(function() {
		
	initButton("query-subsidiary", function() {
		$("#queryForm").attr("action", "subsidiary_listAction.action");
		$("#queryForm").submit();
	});
	
	initButton("query-reset", function() {
		$("#query_subsidiaryName").val("");
	});
	
	initButton("delete-subsidiary", function() {
		$("#queryForm").attr("action", "subsidiary_deleteSubsidiaryAction.action");
		deleteRecord('queryForm', 'dataTable', 'subsidiaryId');
	});
	
	initButton("create-subsidiary", function() {
		openAddForm();
	});
	
	initButton("modify-subsidiary", function() {
		openModifyForm();
	});
	
	
	$('#dataTable').datagrid(
			{
				url: "subsidiary_dataGridAction.action?"+buildCondition(),
				width: '100%',
				height: 'auto',
				striped: true,
				fitColumns: false,
				pagination:true,
				columns:[[
					{field:'subsidiaryId',checkbox:true},
					{field:'name',title:'公司名称',width:100},
					{field:'phone',title:'联系电话',width:120},
					{field:'address',title:'公司地址',width:250},
					{field:'remark',title:'备注'}
				]]
			});
});


function buildCondition() {
	
	return "query_subsidiaryName="+
		encodeURIComponent($("#query_subsidiaryName").val());
}
   
</script>
</head>
<body>

<form id="queryForm" action="subsidiary_listAction.action" method="post">
<div id="queryDiv" class="easyui-accordion" border="false" style="width: 400px;">
	<div title="查询" iconCls="icon-search" style="overflow:auto;padding:10px;">
	<table>
		<tr>
			<td>
				<label style="float: left; margin-right: 5px;">公司名称:</label>
				<s:textfield name="query_subsidiaryName" theme="simple"  />
			</td>
		</tr>
		<tr>
			<td style="vertical-align: top;" colspan="2">
				<a href="javascript:void(0)" id="query-subsidiary" class="easyui-linkbutton" iconCls="icon-search">查询</a>
				<a href="javascript:void(0)" id="query-reset" class="easyui-linkbutton" iconCls="icon-back">重置</a>
			</td>
		</tr>
	</table>
	</div>	
</div>

<hr/>	

<div style="width: 70%;">
	<table id="dataTable" title='公司列表'></table>
</div>
<div style="margin-top: 5px;">
	<a href="javascript:void(0)" id="create-subsidiary" class="easyui-linkbutton" iconCls="icon-add">新建</a>
	<a href="javascript:void(0)" id="modify-subsidiary" class="easyui-linkbutton" iconCls="icon-edit">修改</a>
	<a href="javascript:void(0)" id="delete-subsidiary" class="easyui-linkbutton" iconCls="icon-cancel">删除</a>
</div>

<input type="hidden" name="deleteId" id="deleteId" />

<s:include value="subsidiary_new.jsp"></s:include>
</form>

</body>
</html>